fix(audit): serialize provider audited attributes in queries#2070
Conversation
WalkthroughThe PR fixes malformed provider audit attributes query responses by correcting data unmarshalling alignment. KV values now unmarshal into ChangesAudit Attributes Query and Data Structure Alignment
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@x/audit/keeper/grpc_query.go`:
- Around line 35-47: AllProvidersAttributes (and similarly AuditorAttributes)
currently paginates over the raw ctx.KVStore(q.skey) and calls ParseIDFromKey
for every key; to avoid future panics and make the scan prefix-safe, wrap the
store with the provider prefix before calling sdkquery.Paginate (use
prefix.NewStore(store, types.PrefixProviderID()) or the equivalent) so only keys
written by ProviderKey(...) are iterated, and keep the existing unmarshalling
into types.AuditedAttributesStore and construction of types.AuditedProvider
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 92f340a7-3cb3-4537-9f10-ef228f78f214
📒 Files selected for processing (3)
x/audit/keeper/grpc_query.gox/audit/keeper/grpc_query_test.gox/audit/keeper/keeper.go
💤 Files with no reviewable changes (1)
- x/audit/keeper/keeper.go
Description
Closes: akash-network/support#606
Fixes malformed provider audit attribute query responses by decoding stored
audit values as
AuditedAttributesStoreand reconstructingownerandauditorfrom the store key.The current query implementation decodes audit store values as
AuditedProvider. SinceAuditedAttributesStore.attributesandAuditedProvider.ownerare both protobuf field1, all-provider andauditor-filtered queries return attribute bytes in the
ownerfield whileauditorandattributesare empty.Critical files to review:
x/audit/keeper/grpc_query.gox/audit/keeper/grpc_query_test.gox/audit/keeper/keeper.goValidation:
GOWORK=off go test ./x/audit/keeper -count=1GOWORK=off go test ./x/audit/... -count=1Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow-up issues.
I have...
!to the type prefix if API or client breaking changemainfor normal review and merge.CHANGELOG.md